/******************************************************************************
 * Filename    : VesselSMD.java
 * Author      : LEOH.LEUNG
 * Date Created: 2012-07-16
 * Content     : Definition of ...
 * (c) Copyright XML Asia Limited 2012. All rights reserved.
 * No part of this program may be photocopied reproduced or translated to
 * another program language without prior written consent of XML Asia Limited
 ******************************************************************************/

package com.xmlasia.web.service.smd;

import java.util.ArrayList;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.xmlasia.web.model.Vessel;
import com.xmlasia.web.smd.SMDResponse;

/**
 * 
 * @author LEOH.LEUNG
 *
 */
public class VesselSMD implements SMDService<Vessel>{

	private final Logger logger = LoggerFactory.getLogger(VesselSMD.class);
	
	public SMDResponse fetch(Vessel vessel){
		logger.info("fetch {}", vessel);
		SMDResponse response = new SMDResponse();
		List<Vessel> vesselList = new ArrayList<Vessel>();
		for(int i=0;i<10;i++){
			if(i%2==0){
				vesselList.add(new Vessel(new Long(i), "VRGO6", "OOCL GUANGZHOU", "東方廣州"));
			}else{
				vesselList.add(new Vessel(new Long(i), "3ELQ8", "COSCO ASIA", "中遠亞洲"));
			}
		}
		response.setData(vesselList);
		return response;
	}
	
	@Override
	public Class<Vessel> getObjectClass() {
		return Vessel.class;
	}
	
}
